#include "logondialog.h"
#include "ui_logondialog.h"
#include <QFile>
#include <QMessageBox>
#include "base.h"

LogonDialog::LogonDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::LogonDialog)
{
    ui->setupUi(this);
    connect(this->ui->btn_info,SIGNAL(clicked()),this,SLOT(slotInfo()));

}

LogonDialog::~LogonDialog()
{
    delete ui;
}

QString LogonDialog::getLogin(){
    return this->ui->le_login->text();
}

QString LogonDialog::getPassword(){
    return this->ui->le_pass->text();
}

void LogonDialog::slotInfo(){
    QFile a;
    a.setFileName(":/resources/about.html");
    a.open(QIODevice::ReadOnly | QIODevice::Text);
    // кракозябры блеять
    QString ab = QString::fromUtf8(a.readAll());
    ab.replace("%P_VERSION%",VERSION);
    ab.replace("%P_BUILD%",GIT_HASH);
    QMessageBox::about(this,tr("About program"),ab);
}
